package cn.webdai.swagger.controller;

import cn.webdai.swagger.pojo.User;
import cn.webdai.swagger.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 戴金华
 * @date 2020-01-02 10:10
 */
@RestController
@RequestMapping("/user")
@Api(value = "测试接口",tags = "UserController",description = "测试接口相关 ")
public class UserController {

    /**
     * 添加用户
     * @param user
     * @return
     */
    @PostMapping("/save")
    @ApiOperation(value = "创建用户",notes = "创建用户")
    public Map<String,Object> save(@ApiParam(required = true,name = "user",value = "用户实体user")@RequestBody User user){
        Map<String,Object> resultMap = new HashMap();
        return resultMap;
    }

    /**
     *根据id查找用户
     * @param id
     * @return
     */
    @GetMapping("/get/{id}")
    @ApiImplicitParam(name = "id",value = "用户id",required = true,dataType = "String",paramType = "query")
    @ApiOperation(value = "根据用户id查询用户",notes = "根据用户id查询用户")
    public Map<String,Object> getUser(@PathVariable("id") String id){
        return null;
    }
}
